<?php
class getdata_model extends CI_Model{
	
	function __construct(){
		parent:: __construct();
	}
	
########################################################################################################################################
	/*this function gets the property owner ids from database and return them to the 
	 * 'insertdata->addprop()'*/
	function get_prop_owners(){
		$query = 'SELECT company_id, company_display_name FROM property_companies';
		$query_result = $this->db->query($query);
		$data = array();
		foreach($query_result->result() as $row){
			$data[] = $row;
		}
		return $data;
	}
	
#######################################################################################################################################
	/*this function gets the property ids which do not have geo location data along with it,
	 * and return it to the 'insertdata->addgeo'*/
	function get_geo_missed_propids(){
		$query = 'SELECT project_maindetails.project_id
		FROM project_maindetails
		LEFT OUTER JOIN property_geodata ON project_maindetails.project_id = property_geodata.project_id
		WHERE property_geodata.project_id IS NULL';
		$query_result = $this->db->query($query);
		$data= array();
		foreach($query_result->result() as $row){
			$data[]= $row;
		}
	
		return $data;
	}
	
########################################################################################################################################
	/*this function gets the property owner ids from database and return them to the 
	 * 'insertdata->addgeo'*/
	function is_exsiting_color($value,$variable)
	{
		$this->db->select($value);
		$this->db->where($value,$variable);
		
		$query=$this->db->get('property_geodata');
		if($query->num_rows()>0){
			return TRUE;
			//color exists in database
					
		}
		else{
			return FALSE;
			//color doesn't exists in database
					
		}
	
	}
}